package com.jml.jdk8.方法引用;


import java.util.ArrayList;
import java.util.List;

/**
 * @author:jml
 * @date: 2019/11/27 0027 22:02
 * @description：
 */
public class StudentTest001类名and静态方法 {

    public static void main(String[] args) {
        Student zs = new Student("zs", 10);
        Student ls = new Student("ls", 40);
        Student ww = new Student("ww", 50);
        Student zl = new Student("zl", 90);
        List<Student> students = new ArrayList<>();
        students.add(zs);
        students.add(zl);
        students.add(ls);
        students.add(ww);
        //使用lambda表达式进行排序
        students.sort((s1,s2)->{
            return Student.compareStudentByScore(s1,s2);
        });
        //使用方法引用
        students.sort(Student::compareStudentByScore);
        students.forEach(student -> System.out.println(student.getScore()));


    }
}
